<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="/template.xhtml">
            <ui:define name="title">
                <h:outputText value="#{bundle.myPageTitle}"></h:outputText>
            </ui:define>
            <ui:define name="content">

                    <h:form rendered='#{request.isUserInRole("teacher")}'>
                    #{bundle.teacher}<br />
                         <h:panelGroup rendered="#{courseController.usersCourses.rowCount > 0}">
                              <h:dataTable value="#{courseController.usersCourses}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="odd_row,even_row" rules="all" style="border:solid 1px">
                                <h:column>
                                    <h:outputText value="#{item.courseCode}"/>
                                </h:column>
                                <h:column>
                                    <h:outputText value="#{item.courseName}" rendered="#{localeHelper.englishSet}" />
                                    <h:outputText value="#{item.courseNameNo}" rendered="#{localeHelper.norwegianSet}" />
                                </h:column>
                                <h:column>
                                    <h:commandLink action='#{courseController.teacherPrepareView}' value="#{bundle.VIEW}"/>
                                    <h:outputText value=" :: "/>
                                    <h:commandLink action="#{courseController.teacherPrepareEdit}" value="#{bundle.EDIT}"/>
                                </h:column>
                            </h:dataTable>
                        </h:panelGroup>
                    <h:commandLink action="#{courseController.prepareCreate}" value="#{bundle.createCourseLink}"/><br />
                    <br />
                    </h:form>
                
                    <h:form rendered='#{request.isUserInRole("instadmin")}'>
                    #{bundle.instAdmin} <br />
                    <h:panelGroup rendered="#{courseController.usersInstitutesCourses.rowCount > 0}">
                              <h:dataTable value="#{courseController.usersInstitutesCourses}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="odd_row,even_row" rules="all" style="border:solid 1px">
                                <h:column>
                                    <h:outputText value="#{item.courseCode}" />
                                </h:column>
                                <h:column>
                                    <h:outputText value="#{item.courseName}" rendered="#{localeHelper.englishSet}" />
                                    <h:outputText value="#{item.courseNameNo}" rendered="#{localeHelper.norwegianSet}" />
                                </h:column>
                                <h:column>
                                    <h:commandLink action='#{xmlGenerator.getCourseAsXml(item.courseCode)}' value="#{bundle.downloadXML}" />
                                </h:column>
                            </h:dataTable>
                        </h:panelGroup>
                    <br />
                    </h:form>


                    <h:form rendered='#{request.isUserInRole("sysadmin")}'>
                    #{bundle.sysAdmin}<br />
                    <h:commandLink action="#{personController.prepareList}" value="#{bundle.adminUsers}"/> <br />
                    <h:commandLink action="#{institutionController.prepareList}" value="#{bundle.adminInstitutions}"/> <br />
                    <h:commandLink action="#{facultyController.prepareList}" value="#{bundle.adminFaculties}"/> <br />
                    <h:commandLink action="#{studyProgramController.prepareList}" value="#{bundle.adminStudyPrograms}"/> <br />
                    <br />
                    </h:form>
               
            </ui:define>
        </ui:composition>
    </h:body>
</html>

